<!doctype html>
{php}
$static = '/static/home/';
{/php}
<!--[if IE 7]> <html lang="en" class="ie7"> <![endif]-->
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
    <meta charset="utf-8" />
    <title>{$siteConfig['seo_title']}</title>
    <meta name="apple-mobile-web-app-title" content="{$siteConfig['seo_title']}">
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,width=device-width">
    <link href="{$static}css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}css/icons.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}css/app.min.css" rel="stylesheet" type="text/css" />
    <link href="{$static}css/style.css" rel="stylesheet" type="text/css" />
</head>
<body data-sidebar="dark">
<style type="text/css">
    table tr td {
        vertical-align:middle !important;
    }
</style>
<!-- Begin page -->
<div id="layout-wrapper">

    {include file='public/mine_topbar' /}
    {include file='public/mine_left' /}

    <!-- ============================================================== -->
    <!-- Start right Content here -->
    <!-- ============================================================== -->
    <div class="main-content">

        <div class="page-content">
            <div class="container-fluid">
                <!-- start page title -->
                <div class="row">
                    <div class="col-12">
                        <div class="page-title-box d-flex align-items-center justify-content-between">
                            <h4 class="mb-0 font-size-18"><i class="mdi mdi-internet-explorer"></i> 域名管理</h4>
                            <div class="page-title-right">
                                <ol class="breadcrumb m-0">
                                    <li class="breadcrumb-item"><a href="javascript:void(0)">鹰眼短链</a></li>
                                    <li class="breadcrumb-item active">域名管理</li>
                                </ol>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- end page title -->

                <div class="row justify-content-center">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-xl-6 col-md-6">
                                        <p>用户可自行选择将自己的域名作为下载页面的地址，域名绑定规则如下：</p>
                                        <p>1、域名必须备案,增加域名后,请做CNAME解析到 {$siteConfig['domain_cname']} 地址。</p>
                                        <p>2、新手请查看域名绑定详细教程点击阅读域名绑定教程。</p>
                                        <p>3、自有域名解析10分钟左右生效。</p>
                                        <p>4、默认第一个域名为当前使用的域名。</p>
                                    </div>
                                    <div class="col-xl-2 col-md-6 pt-3">
                                        <a class="btn btn-success btn-block" href="{:url('domain/add')}">添 加</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="header-title">联系列表</div>
                                <div class="table-responsive pb-5">
                                    <table id="datatable" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
                                        <thead>
                                            <tr>
                                                <th>域名</th>
                                                <th>协议</th>
                                                <th>状态</th>
                                                <th>创建时间</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        {empty name="list"}
                                            <tr>
                                                <td>----</td>
                                                <td>----</td>
                                                <td>----</td>
                                                <td>----</td>
                                                <td>----</td>
                                            </tr>
                                        {else /}
                                            {foreach name="list" item="vo"}
                                            <tr>
                                                <td>{$vo.name}</td>
                                                <td>{$vo.httpProtocol}</td>
                                                <td>
                                                    {switch $vo.status }
                                                    {case 0}<span class="color-red">未审核</span>{/case}
                                                    {case 1}<span class="color-green">审核通过</span>{/case}
                                                    {case 2}<span class="color-red">审核拒绝</span>{/case}
                                                    {/switch}
                                                </td>
                                                <td>{$vo.createTime}</td>
                                                <td>
                                                    <a href="javascript:void(0)" class="js-delete" data-id="{$vo.id}">删除</a>
                                                </td>
                                            </tr>
                                            {/foreach}
                                        {/empty}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div> <!-- end col -->
                </div> <!-- end row -->

            </div> <!-- container-fluid -->
        </div>
        <!-- End Page-content -->
    </div>
    <!-- end main content-->

</div>
<!-- END layout-wrapper -->


<!-- JAVASCRIPT -->
<script src="{$static}libs/jquery/jquery.min.js"></script>
<script src="{$static}libs/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="{$static}libs/metismenu/metisMenu.min.js"></script>
<script src="{$static}libs/simplebar/simplebar.min.js"></script>
<script src="{$static}libs/node-waves/waves.min.js"></script>
<script src="{$static}libs/layer/layer.js"></script>

<script src="{$static}js/app.js"></script>
<script type="text/javascript">
    $('.js-delete').click(function () {
        var id = $(this).data('id');
        layer.confirm('您确认要删除该当前域名吗？',
            {
                btn: ['确认', '取消'],
                title:'删除提示'
            },
            function () {
                $.ajax({
                    url: "{:url('domain/del')}",
                    type: "POST",
                    data: {id: id},
                    dataType: 'json',
                    async: false,
                    success: function (res) {
                        if (res.errorCode === 200) {
                            window.location.reload();
                        } else {
                            layer.alert(res.message, {
                                title: '提示',
                                icon: 2
                            });
                        }
                    }
                });
            }
        );
    });
</script>
</body>
</html>
